<template>
  <el-dialog
    :title="title"
    :visible.sync="visible"
    width="30%"
    :before-close="closeDialog"
  >
    <UserForm ref="form" v-bind="$attrs" v-on="$listeners"></UserForm>
    <span slot="footer" class="dialog-footer">
      <el-button @click="closeDialog">取 消</el-button>
      <el-button type="primary" @click="handleConfirm">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import UserForm from "@/views/login/components/LoginForm";
export default {
  components: { UserForm },
  props: {
    visible: {
      type: Boolean,
    },
    title: {
      type: String,
      default: "提示",
    },
  },
  data() {
    return {};
  },
  watch: {
    visible(val) {
      if (!val) {
        this.$nextTick(() => {
          this.$refs.form.resetForm();
        });
      }
    },
  },
  methods: {
    handleUser() {},
    closeDialog() {
      this.$emit("update:visible", false);
    },
    //确认
    handleConfirm() {
      this.$refs.form.login();
    },
  },
};
</script>

<style></style>
